package com.mywork.service;

import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;

import org.springframework.core.convert.converter.Converter;

public class StringToDateConverter implements Converter<String, Date> {

	@Override
	public Date convert(String arg0) {
		// TODO 自动生成的方法存根
		SimpleDateFormat sdf =new SimpleDateFormat("yy-MM-dd");
	
		try {
			return sdf.parse(arg0);
		} catch (ParseException e) {
			// TODO 自动生成的 catch 块
			return new Date();
			
		}
	}

}
